// packageI/ecosphere_watercooler/water_use/bind/bind.js
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    mini_url:'',
    course_name:"",
    device_no:""
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({device_no:options.device_no});

  },
  getData() {
    app._getNetWork({
      url: app.getNetAddresss('plugin.water-machine.frontend.consumer.member-card.index'),
      success: resdata => {
        let {
          data,
          result,
          basic_info,
          msg
        } = resdata.data;
        if (result) {
          let _basic_info = wx.getStorageSync("yz_basic_info") || basic_info;
          let title =_basic_info&&_basic_info.plugin_setting.water_machine_header;
          wx.setNavigationBarTitle({title});
          this.setData({
            mini_url: data.course_url,
            course_name:data.course_name
          })
        } else {
          app.tips(msg);
        }
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.getData();
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})